/*
 * @ddescription: 明细账单
 * @Author: along
 * @Date: 2021-04-12
 * @Last Modified by: along
 * @Last Modified time: 2021-04-12
 */
<template>
    <el-dialog
        :visible.sync="dialogTips"
        width="820px"
        title="账单明细"
        :show-close="true"
        class="billDetailDialog"
    >
        <div class="__wrap">
            <el-table
                :data="tableData"
                height="100%"
                style="width: 100%;height:100%"
                border
                ref="orderListBil"
            >
                <el-table-column
                    type="index"
                    width="80"
                    label="序号"
                    align="center"
                />
                <el-table-column
                    prop="bill_no"
                    label="账单编号"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                />
                <el-table-column
                    prop="shop_goods_order_no"
                    label="订单编号"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                />
                <el-table-column
                    prop="finance_no"
                    label="关联订单编号"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                    :width="150"
                />
                <el-table-column
                    prop="desc"
                    label="财务详情"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                >
                    <template slot-scope="scope">
                        {{ scope.row.desc }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="create_time"
                    label="账单创建时间"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                    :width="150"
                >
                    <template slot-scope="scope">
                        {{ scope.row.create_time * 1000 | dateFormat('yyyy/MM/dd HH:mm') }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="money"
                    label="金额(元)"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                />
            </el-table>

            <!-- /分页 -->
            <div class="pagination-wrapper clearfixNew">
                <el-pagination
                    background
                    :current-page.sync="page.now_page"
                    :page-size="page.page_size"
                    layout="total, prev, pager, next, jumper"
                    :total="page.total_count"
                    @current-change="getTableData"
                />
            </div>
        </div>
    </el-dialog>
</template>

<script>
import { mapState } from 'vuex';
export default {
    data () {
        return {
            dialogTips: false,
            tableData: [],
            page: {
                now_page: 1,
                total_count: 0,
                page_size: 0
            },
        };
    },
    computed: {
        ...mapState({})
    },
    mounted () {
        this.getTableData();
    },
    methods: {
        /**
         * @description 初始化数据
         */
        getTableData (page) {
            this.$post('', {
                page_id: page || this.page.now_page,
                type: 99,
                status: 1,
                create_start_time: '',
                create_end_time: ''
            }, resp => {
                if (resp.code == 1) {
                    this.tableData = resp.data.list;
                    this.page.now_page = resp.data.page.now_page;
                    this.page.total_count = resp.data.page.total_count;
                    this.page.page_size = resp.data.page.page_size;
                }
            });
        },

        /**
         * 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        },

        /**
         * @description 打开弹窗
         */
        show () {
            this.dialogTips = true;
        },

        /**
         * @description 关闭弹窗
         */
        close () {
            this.dialogTips = false;
        }
    }
};
</script>

<style lang="less" scoped>
.__wrap {
    height: 300px;
}
.pagination-wrapper {
    height: 36px;
    background: #fff;
    flex: 1;
    .el-pagination {
        margin-top: 15px;
        float: right;
    }
}
</style>
<style lang="less">
.billDetailDialog {
    .el-dialog__header {
        padding-top: 10px;
        box-shadow:0px 1px 0px 0px rgba(233,233,233,1);
        display: flex;
        align-items: center;
        background: #FAFAFA;
        border-radius: 4px 4px 0 0;
        .el-dialog__title {
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }
        .el-icon-close:before {
            color: rgb(194,194,194);
            font-size: 17px;
            font-weight: bold;
        }
        .el-dialog__headerbtn {
            top: 14px;
        }
    }
    .el-dialog__body {
        padding-left: 24px;
        padding-right: 24px;
        padding-bottom: 60px;
    }
}
</style>